<?php
require $_SERVER['DOCUMENT_ROOT'].'/../_core/common.php';

$msg = array();

//权限验证
if( Role::init() == false ){
	$msg['error'] = false;
	$msg['string'] = '权限不足！';
	$myjson = json_encode($msg); 
	echo $myjson; 
	exit;
}


$db = new DB('star');

$title_id = isset($_POST['title_id']) ? h($_POST['title_id']) : '';
$title_id_arr = explode('|',$title_id);

$msg['error'] = false;
$msg['string'] = '参数有误！';

if( !empty($title_id_arr) ){
	foreach($title_id_arr as $key=>$val){
		$title_id = intval($val);
		if( $title_id > 0 ){
			//更新is_del,updated字段
			$data = array('is_del'=>2,'updated'=>time(),'edit_uid'=>Sessions::get('uid'));
			$db->table('star')->where('title_id='.$title_id)->update($data)->run();
			
			@unlink( $_SERVER['DOCUMENT_ROOT'].'/v/'.$title_id.'/index.html' );
			
			$msg['error'] = true;
			$msg['string'] = '成功删除!';
		}
	}
}

$myjson = json_encode($msg); 
echo $myjson; 
exit;